<%--
  Created by IntelliJ IDEA.
  User: 10953
  Date: 2021/1/4
  Time: 19:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="./font_jnmpf82rjj/iconfont.js"></script>
<script src="./font_jnmpf82rjj/jquery-1.8.0.min.js"></script>
<style>
    .icon {
        width: 10em;
        height: 10em;
        vertical-align: -0.15em;
        fill: currentColor;
        overflow: hidden;
    }
    #ic2{display: none;}
    span{font-size: 50px;}
</style>
<body>
<svg class="icon" id="ic1" aria-hidden="true">
    <use xlink:href="#icon-dianzan"></use>
</svg>
<svg class="icon" id="ic2" aria-hidden="true">
    <use xlink:href="#icon-dianzan1"></use>
</svg><span id="zan">${sessionScope.beginNum}</span>
</body>
<script>
    $(function(){
        $("#ic1").click(function(){
            $(this).hide();
            //发送AJax请求
            var num = $("#zan").text()
            console.log(num)
            // $.post("/numAdd","number="+ num,function(result){
            //     console.log(result)
            //         $("#zan").html(result);
            // })

            $.ajax({
                url:"/numAdd",
                data:"number="+num,
                type:"post",
                dataType:"JSON",
                success:function (result) {
                    $("#zan").html(result.number);
                    console.log(result.number)
                }
            })
            $("#ic2").show();
        })
        $("#ic2").click(function(){
            $(this).hide();
            $("#ic1").show();
            var num = $("#zan").text()
            $.ajax({
                url:"/numSub",
                data:"number="+num,
                type:"post",
                dataType:"JSON",
                success:function (result) {
                    $("#zan").html(result.number);
                    console.log(result.number)
                }
            })


        })
    })
</script>
</html>